package com.touzi.servlets;
import com.touzi.constants.DbCons;
import org.apache.ibatis.session.SqlSessionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

/**
 * 这是项目servlet的基类，主要初始化了几个常量
 */
public class BaseServlet extends HttpServlet {
    public SqlSessionFactory sqlSessionFactory;
    public Logger logger;

    @Override
    public void init() throws ServletException {
        super.init();
        sqlSessionFactory = ((SqlSessionFactory) getServletContext().getAttribute(DbCons.DB_FACTORY));
        logger = LoggerFactory.getLogger(this.getClass());
    }

}
